{Prime Sum}
const
  fi = '231.in';
  fo = '231.out';
  max = 80000;
var
  p : array[1..max] of longint;
  s : array[1..max div 9] of longint;
  n, l, m : longint;

function prime(k : longint) : boolean;
var
  i, c : longint;
begin
  prime := false;
  c := trunc(sqrt(k));
  for i := 1 to l do
  begin
    if p[i] > c then break;
    if k mod p[i] = 0 then exit;
  end;
  prime := true;
end;

procedure init;
var
  i, c : longint;
begin
  l := 2;
  p[1] := 2;
  p[2] := 3;
  for i := 5 to n do
  begin
    c := i mod 6;
    if (c <> 1) and (c <> 5) then continue;
    if prime(i) then
    begin
      inc(l);
      p[l] := i;
    end;
  end;
end;

procedure process;
var
  i : longint;
begin
  m := 0;
  for i := 1 to l-1 do
    if p[i+1] = p[i] + 2 then
    begin
      inc(m);
      s[m] := p[i];
    end;
end;

procedure out;
var
  i : longint;
begin
  writeln(m);
  for i := 1 to m do writeln(s[i], ' ', 2);
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);
  read(n);
  init;
  process;
  out;
  close(output);
  close(input);
end.
